//
//  LabelTimeCell.m
//  OrderSys
//
//  Created by JM on 15/10/11.
//  Copyright © 2015年 zjlskj. All rights reserved.
//

#import "LabelTimeCell.h"
#import "JMPickerDate.h"
@interface LabelTimeCell ()<JMPickerDateDelegate>
@property(nonatomic, retain)NSMutableString *forOutStirng;
@end

@implementation LabelTimeCell
- (NSString *)forOutStirng {
    if (!_forOutStirng) {
        _forOutStirng = [NSMutableString string];
    }
    return _forOutStirng;
}

- (void)awakeFromNib {
    // Initialization code
}
+ (instancetype)cell {
    
    LabelTimeCell *cell =  [[LabelTimeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"LabelTimeCell"];
    cell.leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 90, 40)];
    cell.leftLabel.backgroundColor = [UIColor clearColor];
    cell.leftLabel.font = [UIFont systemFontOfSize:16];
    cell.leftLabel.adjustsFontSizeToFitWidth = YES;
    cell.leftLabel.tag = 1;
    [cell.contentView addSubview:cell.leftLabel];
    
    cell.rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 5, 200, 30)];
    cell.rightLabel.backgroundColor = [UIColor clearColor];
    cell.rightLabel.font = [UIFont systemFontOfSize:16];
    cell.leftLabel.adjustsFontSizeToFitWidth = YES;
    cell.rightLabel.tag = 2;
    [cell.contentView addSubview:cell.rightLabel];
    cell.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"圆箭头-50x50向下.png"]];
    return cell;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (NSString *)valueData {
    return self.forOutStirng;
}

- (void)didSelect {
    [JMPickerDate PopViewWithYYString:self.forOutStirng andIn:self.tableView  andTitle:self.leftLabel.text with:self];
}

- (void)didSeletedDateStr:(NSString *)aStrDate {
    self.rightLabel.text = aStrDate;
}

+ (LabelTimeCell *)cellWithLabel:(NSString *)labelText tableView:(UITableView *) tableView {
    
    LabelTimeCell * cell = [LabelTimeCell cell];
    cell.leftLabel.text = labelText;
    cell.tableView = tableView;
    return cell;
}
@end
